home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1999 November / SOTMC_Nov1999-Ultimate.iso / mac / REALbasic ƒ / Examples / Applications / 3DViewer ƒ / README < prev    next >
Encoding:
Text File  |  1999-03-30  |  4.0 KB  |  97 lines  |  [TEXT/R*ch]

  1. 3D-Viewer 
  2. ---------
  3.  
  4. 3D-Viewer is an example of a basic 3D graphics app in REALbasic.  It
  5. will render shaded 3D models composed of opaque colored polygonal faces
  6. in real time.  
  7.  
  8. The program is not particularly sophisticated or fast, but it should be
  9. useful as an example for people interested in dabbling in 3D graphics
  10. programmng.  There's no facility yet for creating or editing models,
  11. but you can edit the face colors of existing models and save the
  12. modified models to disk.  A number of models are distributed with the
  13. project; these are all taken from the GeomView distribution (see below).
  14.  
  15.  
  16. History
  17. -------
  18.  
  19. 3D-Viewer started out as a pretty straight port of a GPL'd Java applet
  20. ("Viewer3D") written by Daeron Meyer of the Geometry Center at the
  21. University of Minnesota. The applet lets people view 3D objects
  22. described in OOGL-OFF files.  [OOGL is the Geometry Center's "Object-
  23. Oriented Graphics Language" and OFF ("Object File Format") is one file
  24. format supported by the OOGL.]
  25.  
  26. The Geometry Center is unfortunately defunct but there are still a number of
  27. interesting things available from their homepage, at <http://www.geom.umn.edu/>.
  28. Among these is their 3D modelling package, GeomView, which is distributed 
  29. with the complete Unix source code.
  30.  
  31.  
  32. The Code
  33. --------
  34.  
  35. There are two key classes, Viewer3D and OOGL_OFF.
  36.  
  37. Viewer3D is a Canvas subclass.  It interactively displays the image
  38. produced by an object that implements the ViewableObject interface. 
  39. Viewer3D sets the scaling so that the image fits on the display, and
  40. updates a rotation matrix for the object when the user drags the mouse
  41. on the canvas; the object is rescaled if the Option key is help down
  42. while dragging. Viewer3D double-buffers the display so that updates are
  43. smooth, but calls the Paint method of the ViewableObject to actually
  44. render the model.  The Viewer3D class also allows object selection, but
  45.  
  46.  
  47. OOGL_OFF is the class that describes the 3D object; it implements the
  48. ViewableObject interface.  It maintains a display list of 3D vertices
  49. and colored polygonal faces defined using those vertices.  It can read
  50. descriptions of models from OFF-format files on the disk.  It has a
  51. Paint method that will render the model into a Graphics object.
  52. Rendering is done using the Painter's method: faces are sorted in
  53. z-order and drawn from back to front.  No effort is made to deal with
  54. interections of polygons.  Shading is handled by the simple lighting
  55. model described at <http://exaflop.org/docs/lca/lca1.html>.  Selection
  56. of faces is based on the point-in-polygon algorithm presented in the
  57. comp.graphics.algorithms FAQ <http://exaflop.org/docs/cgafaq/>.
  58.  
  59.  
  60. There are a couple of helper classes that may be useful in other contexts:
  61.  
  62. Matrix3D is a standard 4x4 transformation matrix.  It is derived from
  63. the Matrix3D class used in the Sun's demo Java applets.
  64.  
  65. StreamTokenizer is a straight port of the standard Java StreamTokenizer
  66. class, which parse text streams into tokens.  It has been modified to
  67. accept either a String or a TextInputStream for processing. It's used
  68. here by the OOGL_OFF class for parsing OFF files.
  69.  
  70. Credits
  71. -------
  72.  
  73. The final form of 3DViewer owes a lot to Geoff Perlman's many insistent
  74. suggestions.  
  75.  
  76. The original Java version of the OOGL_OFF class is ⌐ Daeron Mayer and
  77. was released under the Gnu Public License.  Besides porting it to
  78. REALbasic, I also added methods to interactively pick faces and to
  79. render models with shading.
  80.  
  81. Except for Daeron Mayer's OOGL_OFF class, most of the original Java code
  82. is ⌐ Sun Microsystems, Inc.
  83.  
  84. The mCanvasButton class was written by S┐ren Olin.  It's available from
  85. <http://www.olin.net/RB/>. You'd think an image button would be easy to
  86. create, but the other ones I tried all had strange quirks; this one
  87. works well.
  88.  
  89.  
  90. March 1999
  91.  
  92. -------------------------------------------------------------------------
  93. W. Thomas Pollard                                  Schrodinger, Inc.
  94. pollard@schrodinger.com                       http://www.schrodinger.com/
  95. -------------------------------------------------------------------------
  96.  
  97.